Skip to content

feat(router): add minPathMargin option to rightAngle router to suppress margin-overlap detours#3266

Merged
kumilingus merged 23 commits intoclientIO:masterfrom
Geliogabalus:right-angle-fix
May 4, 2026
Merged

feat(router): add minPathMargin option to rightAngle router to suppress margin-overlap detours#3266
kumilingus merged 23 commits intoclientIO:masterfrom
Geliogabalus:right-angle-fix

Conversation

@Geliogabalus
Copy link
Copy Markdown
Contributor

@Geliogabalus Geliogabalus commented Apr 7, 2026

Summary

  • Add a minPathMargin option to rightAngleRouter
  • Add sourceMargin and targetMargin options to rightAngleRouter
  • Refactor codebase to increase readablity.
  • Add a right-angle-playground-js example demonstrating the option with movable vertices, anchors, and a resize handle

Test plan

  • Verify that omitting minPathMargin (default null) preserves existing routing behaviour in all side combinations
  • Verify new sourceMargin and targetMargin options
  • Verify the right-angle-playground-js example loads and the router respects the minPathMargin: 10 setting when elements are dragged close together

🤖 Generated with Claude Code

@Geliogabalus Geliogabalus changed the title fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations fix(dia): correct bounding rect measurement for HTML element magnets Apr 8, 2026
@Geliogabalus Geliogabalus changed the title fix(dia): correct bounding rect measurement for HTML element magnets fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations Apr 8, 2026
@Geliogabalus Geliogabalus changed the title fix(router): add ignoreOverlappingMargin support to all routeBetweenPoints combinations fix(router): add minMargin option to rightAngle router to suppress margin-overlap detours Apr 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new minMargin option to the rightAngle router to reduce unnecessary “detour around margin” routes when elements are adjacent and their margin zones only minimally overlap, and introduces a new JS playground example to demonstrate the behavior.

Changes:

  • Add minMargin option to rightAngleRouter and thread it through all routeBetweenPoints calls.
  • Add “ignore overlapping margin” logic in routeBetweenPoints for opposite-side routing cases.
  • Add a new examples/right-angle-playground-js workspace demo (and lockfile entry).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
yarn.lock Adds the new @joint/demo-right-angle-playground-js workspace entry.
packages/joint-core/src/routers/rightAngle.mjs Implements minMargin option and new margin-overlap suppression logic.
examples/right-angle-playground-js/src/styles.css Styling for the new playground demo.
examples/right-angle-playground-js/src/main.js Demo setup showcasing rightAngle routing with minMargin.
examples/right-angle-playground-js/package.json Declares the new example workspace package and its scripts/deps.
examples/right-angle-playground-js/index.html HTML entrypoint for the new Vite demo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/joint-core/src/routers/rightAngle.mjs Outdated
Comment thread packages/joint-core/src/routers/rightAngle.mjs
Comment thread packages/joint-core/src/routers/rightAngle.mjs Outdated
Comment thread packages/joint-core/src/routers/rightAngle.mjs Outdated
Comment thread packages/joint-core/types/joint.d.ts Outdated
kumilingus
kumilingus previously approved these changes Apr 14, 2026
@kumilingus kumilingus self-requested a review April 14, 2026 10:47
@kumilingus kumilingus dismissed their stale review April 14, 2026 10:48

misclick

@kumilingus kumilingus changed the title fix(router): add minMargin option to rightAngle router to suppress margin-overlap detours feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours Apr 14, 2026
@Geliogabalus Geliogabalus marked this pull request as draft April 15, 2026 08:46
# Conflicts:
#	packages/joint-core/src/routers/rightAngle.mjs
(cherry picked from commit 5192e2d)
@Geliogabalus Geliogabalus marked this pull request as ready for review April 20, 2026 10:03
# Conflicts:
#	packages/joint-core/types/joint.d.ts
# Conflicts:
#	packages/joint-core/src/routers/rightAngle.mjs
#	packages/joint-core/test/jointjs/routers.js
@Geliogabalus Geliogabalus changed the title feat(router): add minMargin option to rightAngle router to suppress margin-overlap detours feat(router): add minPathMargin option to rightAngle router to suppress margin-overlap detours May 4, 2026
@kumilingus kumilingus merged commit 858d049 into clientIO:master May 4, 2026
3 checks passed
kumilingus added a commit that referenced this pull request May 4, 2026
Co-authored-by: Arthur Khakhlou <arthur.khokhlov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants